#[derive(Eq, Clone, Debug)]
struct SourceIdInner {
url: Url,
+ canonical_url: Url,
kind: Kind,
// e.g. the exact git revision of the specified branch for a Git Source
precise: Option<String>
SourceId {
inner: Arc::new(SourceIdInner {
kind: kind,
+ canonical_url: git::canonicalize_url(&url),
url: url,
precise: None,
}),
if self.kind != other.kind { return false }
if self.url == other.url { return true }
- match (&self.kind, &other.kind, &self.url, &other.url) {
- (&Kind::Git(ref ref1), &Kind::Git(ref ref2), u1, u2) => {
- ref1 == ref2 &&
- git::canonicalize_url(u1) == git::canonicalize_url(u2)
+ match (&self.kind, &other.kind) {
+ (&Kind::Git(ref ref1), &Kind::Git(ref ref2)) => {
+ ref1 == ref2 && self.canonical_url == other.canonical_url
}
_ => false,
}
fn hash<S: hash::Hasher>(&self, into: &mut S) {
self.inner.kind.hash(into);
match *self.inner {
- SourceIdInner { kind: Kind::Git(..), ref url, .. } => {
- git::canonicalize_url(url).hash(into)
+ SourceIdInner { kind: Kind::Git(..), ref canonical_url, .. } => {
+ canonical_url.hash(into)
}
_ => self.inner.url.hash(into),
}